/**     
* @Title: RedisCacheManager.java   
* @Package com.yitong.spring.redis   
* @Description: TODO   
* @author xaoyaoyao
* @date 2017年7月22日 下午7:47:05
*/
package com.xnkf.common.shiro.web;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;

import redis.clients.jedis.JedisPool;

/**
 * @ClassName: RedisCacheManager
 * @Description: TODO
 * @author xaoyaoyao
 * @date 2017年7月22日 下午7:47:05
 * 
 */
public class RedisCacheManager implements CacheManager {

	private JedisPool jedisPool;

	public RedisCacheManager(JedisPool jedisPool) {
		this.jedisPool = jedisPool;
	}

	@Override
	public <K, V> Cache<K, V> getCache(String section) throws CacheException {
		return new RedisCache<K, V>(jedisPool, section);
	}

	/**
	 * @param jedisPool
	 *            the jedisPool to set
	 */
	public void setJedisPool(JedisPool jedisPool) {
		this.jedisPool = jedisPool;
	}
}
